package com.sugar.follow.up.module.business.dal.mysql.patientsqpg;

import com.sugar.follow.up.framework.common.pojo.PageResult;
import com.sugar.follow.up.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.sugar.follow.up.framework.mybatis.core.mapper.BaseMapperX;
import com.sugar.follow.up.module.business.controller.admin.patient.sqpg.vo.PatientSqpgPageReqVO;
import com.sugar.follow.up.module.business.dal.dataobject.patientsqpg.PatientSqpgDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 术前评估 Mapper
 *
 * @author Ysugar
 */
@Mapper
public interface PatientSqpgMapper extends BaseMapperX<PatientSqpgDO> {

    default PageResult<PatientSqpgDO> selectPage(PatientSqpgPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PatientSqpgDO>()
                .eqIfPresent(PatientSqpgDO::getPatientId, reqVO.getPatientId())
                .likeIfPresent(PatientSqpgDO::getPatientName, reqVO.getPatientName())
                .eqIfPresent(PatientSqpgDO::getDoctorId, reqVO.getDoctorId())
                .likeIfPresent(PatientSqpgDO::getDoctorName, reqVO.getDoctorName())
                .betweenIfPresent(PatientSqpgDO::getExaminationDate, reqVO.getExaminationDate())
                .eqIfPresent(PatientSqpgDO::getExaminationProject, reqVO.getExaminationProject())
                .betweenIfPresent(PatientSqpgDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PatientSqpgDO::getId));
    }

}